#include <my_head.h>

int main(int argc, const char *argv[]){
    FILE *fp = fopen("hello.txt", "r");
    if(NULL == fp)
        ERR_LOG("fopen error");
    char buff[5] = {0};
    // 在文件中读取字符串
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //abcd
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //efg\n
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //1234
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //\n
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //xy\n
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //\n
    fgets(buff, sizeof(buff), fp);
    printf("buff = [%s]\n", buff); //xja  --vscode编辑的文件最后一行结尾没有\n
    fclose(fp);
    return 0;
}